 |
 |
 |
 |
 |
 |
 |
 |
The delete
operator frees up the memory allocated
|
|
through new.
To do so, the syntax is as in the example.
|
|
delete ptr;
|
|
|
After deleting
a pointer, it can be a good idea to reset it
|
|
to point to NULL.
|
|
|
NULL is a standard compiler-defined
statement that
|
|
sets the
pointer to point to, literally, nothing. By doing
|
|
this, you
minimise the potential for doing something
|
|
foolish with
the pointer.
|
|